<template>
	<view class="addresslist">
		<u-navbar title="新增地址" @rightClick="rightClick" :autoBack="true">
		</u-navbar>

		<view class="listcard">
			<view class="itemcard">
				<view class="cardaddressitem">
					<view class="cardaddressitemname">
						门牌号
					</view>
					<u--input placeholder="请输入内容" border="surround" v-model="address" @change="change"></u--input>
				</view>
				<view class="cardaddressitem">
					<view class="cardaddressitemname">
						联系人
					</view>
					<u--input placeholder="请输入内容" border="surround" v-model="nickname" @change="change"></u--input>
				</view>
				<view class="cardaddressitem">
					<view class="cardaddressitemname">
						手机号
					</view>
					<u--input placeholder="请输入内容" type="number" border="surround" v-model="phone"
						@change="changeitem"></u--input>
				</view>

			</view>
			<view class="defaultAddress">
				<view class="defaultAddresschange">
					<view class="defaultAddresschangetop">
						<view class="">
							设置默认地址
						</view>
						<view class="">
							<u-switch v-model="value" @change="change"></u-switch>
						</view>
					</view>
					<u-divider></u-divider>
					<view class="defaultAddresschangebottom">
						温馨提示：设置默认后，优先使用该地址
					</view>
				</view>
			</view>
		</view>
		<view class="addaddress" @click="addaddressitem">
			保存
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: false,
				phone: '',
				nickname: '',
				address: ''
			}
		},
		methods: {
			rightClick() {
				console.log('rightClick');
				uni.reLaunch({
					url: '/pages/addresslist/addresslist'
				})
			},

			addaddressitem() {
				uni.reLaunch({
					url: '/pages/addresslist/addresslist'
				})
			},
			changeitem() {

			},
			change(e) {
				console.log('change', e);
			},
		}
	}
</script>

<style lang="less" scoped>

	 
	.addresslist {
		width: 100%;
		height: 100vh;
		position: relative;
		background-color: #f9f9f9;


		.itemcard {
			background: #fff;
			box-sizing: border-box;
			padding: 10px;
		}

		.listcard {
			position: relative;
			top: 12%;
			width: 100%;
			height: calc(100vh - 12% - 70px);
			//background-color: #ffff7f;
			overflow: scroll;

			.cardaddressitem {
				width: 90%;
				position: relative;
				left: 50%;
				transform: translateX(-50%);
				height: 70px;
				background: #fff;
				margin-bottom: 10px;

				.cardaddressitemname {
					font-size: 16px;
					font-weight: 500;
					margin-bottom: 10px;
				}
			}
		}

		.defaultAddress {
			width: 100%;
			margin-top: 10px;
			background: #fff;


			.defaultAddresschange {
				width: 90%;
				margin: 0 auto;
				height: 70px;
				//background: #ff5c57;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				padding: 10px 0;

				.defaultAddresschangetop {
					display: flex;
					justify-content: space-between;
					font-weight: 500;
				}

				.defaultAddresschangebottom {
					font-size: 14px;
					color: #ccc;
				}
			}
		}

		.addaddress {
			width: 90%;
			position: fixed;
			bottom: 30px;
			left: 50%;
			transform: translateX(-50%);
			background-color: #ff5c57;
			height: 40px;
			line-height: 40px;
			text-align: center;
			border-radius: 10px;
			color: #fff;

		}
	}

	.u-divider {
		margin: 10px 0 !important;
	}
</style>